package edu.uoc.tdp.pac3.ui.client;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ClientMenuActionListener implements ActionListener {
	
	private ClientFrame frame;
	
	public ClientMenuActionListener(ClientFrame frame) {
		this.frame = frame;
	}
	
	public void actionPerformed(ActionEvent e) {
		  if(e.getActionCommand()=="connectRMI"){
			  boolean ok = frame.createClient();
			  if(ok)
				  frame.getJMenuBar().getMenu(1).setEnabled(true);
		  }else if(e.getActionCommand()=="exit"){
			  System.exit(0);
		  }else if(e.getActionCommand()=="newStock"){
			  frame.setPanel(1);
		  }else if(e.getActionCommand()=="newRequest"){
			  frame.setPanel(2);
		  }else if(e.getActionCommand()=="resolveRequests"){
			  frame.setPanel(3);
		  }

	  }

}
